import 'package:flutter/widgets.dart';
import 'package:library_base/constant/constant.dart';
import 'package:library_base/entities/car_entity.dart';
import 'package:library_base/ext/theme_data_ext.dart';
import 'package:library_base/res/styles.dart';
import 'package:library_base/utils/theme_util.dart';
import 'package:library_base/widget/button/ink_bg_well.dart';
import 'package:library_base/res/edge.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:library_base/widget/image/local_image.dart';

Widget getListItem(
  BuildContext context,
  CarEntity model, {
  bool isHasBottomLine = false,
  Callback<CarEntity>? onTap,
}) {
  List<Widget> widgets = [];

  List<Widget> item = [];
  item.add(Expanded(child: Text(model.carModelName, style: textNormal30)));
  if (model.isSelect) {
    item.add(Padding(
        padding: EdgeInsets.only(right: 40.w, left: 8.w),
        child: LocalImage('common_√', package: Constant.packLib(), width: 25.r, height: 25.r)));
  }
  widgets.add(Container(
      padding: edgeTB40,
      alignment: Alignment.centerLeft,
      margin: edgeLR24,
      child: Row(
        children: item,
      )));
  if (isHasBottomLine) {
    widgets.add(Container(
      margin: edgeLR24,
      color: ThemeUtil.getTheme().dividingLineColor(),
      width: double.infinity,
      height: 0.5,
    ));
  }
  return columnInkBgWell<CarEntity>(model, children: widgets, onTap: onTap);
}
